home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / contrib / jmr.bst < prev    next >
Text File  |  1994-07-31  |  26KB  |  1,355 lines

  1. % BibTeX standard bibliography style `jmr' (one of the harvard family)
  2.     % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  3.     % Copyright (C) 1991, all rights reserved.
  4.     % Copying of this file is authorized only if either
  5.     % (1) you make absolutely no changes to your copy, including name, or
  6.     % (2) if you do make changes, you name it something other than
  7.     % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
  8.         % dcu.bst or kluwer.bst, jmr.bst.
  9.     % This restriction helps ensure that all standard styles are identical.
  10.     % The file harvard.tex has the documentation for this style.
  11.  
  12. % ACKNOWLEDGEMENT:
  13. %   This document is a modified version of alpha.bst to which it owes much of
  14. %   its functionality.
  15.  
  16. % AUTHOR
  17. %   Peter Williams, Key Centre for Design Quality, Sydney University
  18. %   e-mail: peterw@archsci.arch.su.oz.au
  19.  
  20. ENTRY
  21.   { address
  22.     author
  23.     booktitle
  24.     chapter
  25.     edition
  26.     editor
  27.     howpublished
  28.     institution
  29.     journal
  30.     key
  31.     month
  32.     note
  33.     number
  34.     organization
  35.     pages
  36.     publisher
  37.     school
  38.     series
  39.     title
  40.     type
  41.     URL
  42.     volume
  43.     year
  44.   }
  45.   { field.used etal.allowed etal.required} %%%XXX change
  46.   { extra.label sort.label list.year }
  47.  
  48. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  49.  
  50. FUNCTION {init.state.consts}
  51. { #0 'before.all :=
  52.   #1 'mid.sentence :=
  53.   #2 'after.sentence :=
  54.   #3 'after.block :=
  55. }
  56.  
  57. STRINGS { s t f }
  58.  
  59. FUNCTION {output.nonnull}
  60. { 's :=
  61.   output.state mid.sentence =
  62.     { ", " * write$ }
  63.     { output.state after.block =
  64.     { add.period$ write$
  65.       newline$
  66.       "\newblock " write$
  67.     }
  68.     { output.state before.all =
  69.         'write$
  70.         { add.period$ " " * write$ }
  71.       if$
  72.     }
  73.       if$
  74.       mid.sentence 'output.state :=
  75.     }
  76.   if$
  77.   s
  78. }
  79.  
  80. FUNCTION {output}
  81. { duplicate$ empty$
  82.     'pop$
  83.     'output.nonnull
  84.   if$
  85. }
  86.  
  87. FUNCTION {output.check}
  88. { 't :=
  89.   duplicate$ empty$
  90.     { pop$ "empty " t * " in " * cite$ * warning$ }
  91.     'output.nonnull
  92.   if$
  93. }
  94.  
  95. FUNCTION {item.check}
  96. { 't :=
  97.   empty$
  98.     { "empty " t * " in " * cite$ * warning$ }
  99.     { skip$ }
  100.   if$
  101. }
  102.  
  103. FUNCTION {fin.entry}
  104. { add.period$
  105.   write$
  106.   newline$
  107. }
  108.  
  109. FUNCTION {new.block}
  110. { output.state before.all =
  111.     'skip$
  112.     { after.block 'output.state := }
  113.   if$
  114. }
  115.  
  116. FUNCTION {not}
  117. {   { #0 }
  118.     { #1 }
  119.   if$
  120. }
  121.  
  122. FUNCTION {and}
  123. {   'skip$
  124.     { pop$ #0 }
  125.   if$
  126. }
  127.  
  128. FUNCTION {or}
  129. {   { pop$ #1 }
  130.     'skip$
  131.   if$
  132. }
  133.  
  134. FUNCTION {field.or.null}
  135. { duplicate$ empty$
  136.     { pop$ "" }
  137.     'skip$
  138.   if$
  139. }
  140.  
  141. FUNCTION {emphasize}
  142. { duplicate$ empty$
  143.     { pop$ "" }
  144.     { "{\em " swap$ * "}" * }
  145.   if$
  146. }
  147.  
  148. FUNCTION {embolden}
  149. { duplicate$ empty$
  150.     { pop$ "" }
  151.     { "{\bf " swap$ * "}" * }
  152.   if$
  153. }
  154.  
  155. FUNCTION {quote}
  156. { duplicate$ empty$
  157.     { pop$ "" }
  158.     { "`" swap$ * "'" * }
  159.   if$
  160. }
  161.  
  162. FUNCTION {write.url}
  163. { URL empty$
  164.     { skip$ }
  165.     { "\newline\harvardurl{" URL * "}" * write$ newline$ }
  166.   if$
  167. }
  168.  
  169. INTEGERS { nameptr namesleft numnames }
  170.  
  171. FUNCTION {format.rem.names}
  172. { 's :=
  173.   'f :=
  174.   #2 'nameptr :=
  175.   s num.names$ 'numnames :=
  176.   numnames #1 - 'namesleft :=
  177.     { namesleft #0 > }
  178.     { s nameptr f format.name$ 't :=
  179.       nameptr #1 >
  180.     { namesleft #1 >
  181.         { ", " * t * }
  182.         { t "others" =
  183.         { " et~al." * }
  184.         { " \harvardand\ " * t * }
  185.           if$
  186.         }
  187.       if$
  188.     }
  189.     't
  190.       if$
  191.       nameptr #1 + 'nameptr :=
  192.       namesleft #1 - 'namesleft :=
  193.     }
  194.   while$
  195. }
  196.  
  197. FUNCTION {format.authors}
  198. { author empty$
  199.     { "" }
  200.     { author #1 "{vv~}{ll}{, jj}{, ff}" format.name$
  201.       "{ff }{vv~}{ll}{, jj}" author format.rem.names
  202.     }
  203.   if$
  204. }
  205.  
  206. FUNCTION {format.editors}
  207. { editor empty$
  208.     { "" }
  209.     { editor #1 "{vv~}{ll}{, jj}{, ff}" format.name$
  210.       "{ff }{vv~}{ll}{, jj}" editor format.rem.names
  211.       editor num.names$ #1 >
  212.     { ", eds" * }
  213.     { ", ed." * }
  214.       if$
  215.     }
  216.   if$
  217. }
  218.  
  219. FUNCTION {format.editors.reverse}
  220. { editor empty$
  221.     { "" }
  222.     { editor #1 "{f.}{vv~}{ll}{, jj}" format.name$
  223.       "{f.}{vv~}{ll}{, jj}" editor format.rem.names
  224.       editor num.names$ #1 >
  225.     { ", eds" * }
  226.     { ", ed." * }
  227.       if$
  228.     }
  229.   if$
  230. }
  231.  
  232. FUNCTION {format.title}
  233. { title empty$
  234.     { "" }
  235.     { title "t" change.case$ }
  236.   if$
  237. }
  238.  
  239. FUNCTION {n.dashify}
  240. { 't :=
  241.   ""
  242.     { t empty$ not }
  243.     { t #1 #1 substring$ "-" =
  244.     { t #1 #2 substring$ "--" = not
  245.         { "--" *
  246.           t #2 global.max$ substring$ 't :=
  247.         }
  248.         {   { t #1 #1 substring$ "-" = }
  249.         { "-" *
  250.           t #2 global.max$ substring$ 't :=
  251.         }
  252.           while$
  253.         }
  254.       if$
  255.     }
  256.     { t #1 #1 substring$ *
  257.       t #2 global.max$ substring$ 't :=
  258.     }
  259.       if$
  260.     }
  261.   while$
  262. }
  263.  
  264. FUNCTION {format.btitle}
  265. { title emphasize
  266. }
  267.  
  268. FUNCTION {tie.or.space.connect}
  269. { duplicate$ text.length$ #3 <
  270.     { "~" }
  271.     { " " }
  272.   if$
  273.   swap$ * *
  274. }
  275.  
  276. FUNCTION {either.or.check}
  277. { empty$
  278.     'pop$
  279.     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  280.   if$
  281. }
  282.  
  283. FUNCTION {format.bvolume}
  284. { volume empty$
  285.     { "" }
  286.     { "Vol." volume tie.or.space.connect
  287.       series empty$
  288.     'skip$
  289.     { " of " * series emphasize * }
  290.       if$
  291.       "volume and number" number either.or.check
  292.     }
  293.   if$
  294. }
  295.  
  296. FUNCTION {format.number.series}
  297. { volume empty$
  298.     { number empty$
  299.     { series field.or.null }
  300.     { output.state mid.sentence =
  301.         { "number" }
  302.         { "Number" }
  303.       if$
  304.       number tie.or.space.connect
  305.       series empty$
  306.         { "there's a number but no series in " cite$ * warning$ }
  307.         { " {\em in} " * series quote * }
  308.       if$
  309.     }
  310.       if$
  311.     }
  312.     { "" }
  313.   if$
  314. }
  315.  
  316. FUNCTION {format.edition}
  317. { edition empty$
  318.     { "" }
  319.     { output.state mid.sentence =
  320.     { edition "l" change.case$ " edn" * }
  321.     { edition "t" change.case$ " edn" * }
  322.       if$
  323.     }
  324.   if$
  325. }
  326.  
  327. INTEGERS { multiresult }
  328.  
  329. FUNCTION {multi.page.check}
  330. { 't :=
  331.   #0 'multiresult :=
  332.     { multiresult not
  333.       t empty$ not
  334.       and
  335.     }
  336.     { t #1 #1 substring$
  337.       duplicate$ "-" =
  338.       swap$ duplicate$ "," =
  339.       swap$ "+" =
  340.       or or
  341.     { #1 'multiresult := }
  342.     { t #2 global.max$ substring$ 't := }
  343.       if$
  344.     }
  345.   while$
  346.   multiresult
  347. }
  348.  
  349. FUNCTION {format.pages}
  350. { pages empty$
  351.     { "" }
  352.     { pages multi.page.check
  353.     { "pp.~" pages n.dashify * }
  354.     { "p.~" pages * }
  355.       if$
  356.     }
  357.   if$
  358. }
  359.  
  360. FUNCTION {format.vol.num.pages}
  361. { volume embolden field.or.null
  362.   number empty$
  363.     'skip$
  364.     { "(" number * ")" * *
  365.       volume empty$
  366.     { "there's a number but no volume in " cite$ * warning$ }
  367.     'skip$
  368.       if$
  369.     }
  370.   if$
  371.   pages empty$
  372.     'skip$
  373.     { duplicate$ empty$
  374.     { pop$ format.pages }
  375.     { ",~" * pages n.dashify * }
  376.       if$
  377.     }
  378.   if$
  379. }
  380.  
  381. FUNCTION {format.chapter.pages}
  382. { chapter empty$
  383.     'format.pages
  384.     { type empty$
  385.     { "chapter" }
  386.     { type "l" change.case$ }
  387.       if$
  388.       chapter tie.or.space.connect
  389.       pages empty$
  390.     'skip$
  391.     { ", " * format.pages * }
  392.       if$
  393.     }
  394.   if$
  395. }
  396.  
  397. FUNCTION {format.in.ed.booktitle}
  398. { booktitle empty$
  399.     { "" }
  400.     { editor empty$
  401.     { "{\em in} " booktitle quote * }
  402.     { "{\em in} " format.editors.reverse * ", " * booktitle quote * }
  403.       if$
  404.     }
  405.   if$
  406. }
  407.  
  408. FUNCTION {empty.misc.check}
  409. { author empty$ title empty$ howpublished empty$
  410.   month empty$ year empty$ note empty$
  411.   and and and and and
  412.   key empty$ not and
  413.     { "all relevant fields are empty in " cite$ * warning$ }
  414.     'skip$
  415.   if$
  416. }
  417.  
  418. FUNCTION {format.thesis.type}
  419. { type empty$
  420.     'skip$
  421.     { pop$
  422.       type "t" change.case$
  423.     }
  424.   if$
  425. }
  426.  
  427. FUNCTION {format.tr.number}
  428. { type empty$
  429.     { "Technical Report" }
  430.     'type
  431.   if$
  432.   number empty$
  433.     { "t" change.case$ }
  434.     { number tie.or.space.connect }
  435.   if$
  436. }
  437.  
  438. FUNCTION {format.article.crossref}
  439. { key empty$
  440.     { journal empty$
  441.     { "need key or journal for " cite$ * " to crossref " * crossref *
  442.       warning$
  443.       ""
  444.     }
  445.     { "in {\em " journal * "\/} \cite{" * crossref * "}" *}
  446.       if$
  447.     }
  448.     { "{\em in} \citeasnoun{" crossref * "}" * }
  449.   if$
  450.  
  451. }
  452.  
  453. FUNCTION {format.book.crossref}
  454. { volume empty$
  455.     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  456.       "in "
  457.     }
  458.     { "Vol." volume tie.or.space.connect
  459.       " of " *
  460.     }
  461.   if$
  462.   editor empty$
  463.   editor field.or.null author field.or.null =
  464.   or
  465.     { key empty$
  466.     { series empty$
  467.         { "need editor, key, or series for " cite$ * " to crossref " *
  468.           crossref * warning$
  469.           "" *
  470.         }
  471.         { "{\em " * series * "\/} \cite{" * crossref * "}" *}
  472.       if$
  473.     }
  474.     { " \citeasnoun{" * crossref * "}" * }
  475.       if$
  476.     }
  477.     { " \citeasnoun{" * crossref * "}" * }
  478.   if$
  479. }
  480.  
  481. FUNCTION {format.incoll.inproc.crossref}
  482. { editor empty$
  483.   editor field.or.null author field.or.null =
  484.   or
  485.     { key empty$
  486.     { booktitle empty$
  487.         { "need editor, key, or booktitle for " cite$ * " to crossref " *
  488.           crossref * warning$
  489.           ""
  490.         }
  491.         { "in {\em " booktitle * "\/}" * " \cite{" * crossref * "}" *}
  492.       if$
  493.     }
  494.     { "{\em in} \citeasnoun{" crossref * "}" * }
  495.       if$
  496.     }
  497.     { "{\em in} \citeasnoun{" crossref * "}" * }
  498.   if$
  499.   
  500. }
  501.  
  502. INTEGERS { len }
  503.  
  504. FUNCTION {chop.word}
  505. { 's :=
  506.   'len :=
  507.   s #1 len substring$ =
  508.     { s len #1 + global.max$ substring$ }
  509.     's
  510.   if$
  511. }
  512.  
  513. INTEGERS { ind tsslen }
  514.  
  515. STRINGS { tss ret rss istr }
  516.  
  517. FUNCTION {replace.substring}{
  518.   'rss :=
  519.   'tss :=
  520.   'istr :=
  521.   "" 'ret :=
  522.   tss text.length$ 'tsslen :=
  523.   #1 'ind :=
  524.     { istr ind tsslen substring$ "" = not }
  525.     { istr ind tsslen substring$ tss =
  526.         { ret rss * 'ret :=
  527.           ind tsslen + 'ind :=
  528.         }
  529.         { ret istr ind #1 substring$ * 'ret :=
  530.           ind #1 + 'ind :=
  531.         }
  532.       if$
  533.     }
  534.   while$
  535.   ret
  536. }
  537.  
  538. FUNCTION {format.lab.names.abbr}
  539. { 's :=
  540.   s num.names$ 'numnames :=
  541.   numnames #1 >
  542.     { numnames #2 >
  543.     { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  544.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  545.             { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  546.         { s #1 "{vv~}{ll}" format.name$ " \harvardand\ " *
  547.               s #2 "{vv~}{ll}" format.name$ * 
  548.             }
  549.           if$
  550.         }
  551.       if$
  552.     }
  553.     { s #1 "{ff }{vv~}{ll}" format.name$ }
  554.   if$
  555. }
  556.  
  557. FUNCTION {format.lab.names.full}
  558. { 's :=
  559.   #1 'nameptr :=
  560.   s num.names$ 'numnames :=
  561.   numnames 'namesleft :=
  562.     { namesleft #0 > }
  563.     { s nameptr "{vv~}{ll}" format.name$ 't :=
  564.       nameptr #1 >
  565.     { namesleft #1 >
  566.         { ", " * t * }
  567.         { t "others" =
  568.         { " et~al." * }
  569.         { " \harvardand\ " * t * }
  570.           if$
  571.         }
  572.       if$
  573.     }
  574.     't
  575.       if$
  576.       nameptr #1 + 'nameptr :=
  577.       namesleft #1 - 'namesleft :=
  578.     }
  579.   while$
  580. }
  581.  
  582. INTEGERS { author.field editor.field organization.field title.field key.field }
  583.  
  584. FUNCTION {init.field.constants}
  585. { #0 'author.field :=
  586.   #1 'editor.field :=
  587.   #2 'organization.field :=
  588.   #3 'title.field :=
  589.   #4 'key.field :=
  590. }
  591.  
  592. FUNCTION {make.list.label}
  593. { author.field field.used =
  594.     { format.authors }
  595.     { editor.field field.used =
  596.         { format.editors }
  597.         { organization.field field.used =
  598.             { "The " #4 organization chop.word #3 text.prefix$ }
  599.             { title.field field.used =
  600.                 { format.btitle }
  601.                 { key.field field.used =
  602.                     { key #3 text.prefix$ }
  603.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  604.                   if$
  605.                 }
  606.               if$
  607.             }
  608.           if$
  609.         }
  610.       if$
  611.     }
  612.   if$
  613. }
  614.  
  615. FUNCTION {make.full.label}
  616. { author.field field.used =
  617.     { author format.lab.names.full }
  618.     { editor.field field.used =
  619.         { editor format.lab.names.full }
  620.         { organization.field field.used =
  621.             { "The " #4 organization chop.word #3 text.prefix$ }
  622.             { title.field field.used =
  623.                 { format.btitle }
  624.                 { key.field field.used =
  625.                     { key #3 text.prefix$ }
  626.                     { "Internal error :001 on " cite$ * " label" * warning$ }
  627.                   if$
  628.                 }
  629.               if$
  630.             }
  631.           if$
  632.         }
  633.       if$
  634.     }
  635.   if$
  636. }
  637.  
  638. FUNCTION {make.abbr.label} %%%XXX change
  639. {
  640.   etal.allowed
  641.     { author.field field.used =
  642.         { author format.lab.names.abbr }
  643.         { editor.field field.used =
  644.             { editor format.lab.names.abbr }
  645.             { organization.field field.used =
  646.                 { "The " #4 organization chop.word #3 text.prefix$ }
  647.                 { title.field field.used =
  648.                     { format.btitle }
  649.                     { key.field field.used =
  650.                         { key #3 text.prefix$ }
  651.                         {"Internal error :001 on " cite$ * " label" * warning$ }
  652.                       if$
  653.                     }
  654.                   if$
  655.                 }
  656.               if$
  657.             }
  658.           if$
  659.         }
  660.       if$
  661.     }
  662.     { make.full.label }
  663.   if$
  664. }
  665.  
  666. FUNCTION {output.bibitem}
  667. { newline$
  668.   etal.allowed        %%%XXX change
  669.   etal.required
  670.   and
  671.     {
  672.       "\harvarditem[" write$
  673.       make.abbr.label write$
  674.       "]{" write$
  675.     }
  676.     {
  677.       "\harvarditem{" write$
  678.     }
  679.   if$
  680.   make.full.label write$
  681.   "}{" write$
  682.   list.year write$
  683.   "}{" write$
  684.   cite$ write$
  685.   "}" write$
  686.   newline$
  687.   ""
  688.   before.all 'output.state :=
  689. }
  690.  
  691. FUNCTION {list.label.output}
  692. { make.list.label " " * write$
  693. }
  694.  
  695. FUNCTION {article}
  696. { output.bibitem
  697.   list.label.output
  698.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  699.   author "author" item.check
  700.   title.field field.used =
  701.     { skip$ }
  702.     { format.title quote "title" output.check }
  703.   if$
  704.   crossref missing$
  705.     { journal emphasize "journal" duplicate$ item.check
  706.       " " * format.vol.num.pages * output
  707.     }
  708.     { format.article.crossref output.nonnull
  709.       format.pages output
  710.     }
  711.   if$
  712.   new.block
  713.   note output
  714.   fin.entry
  715.   write.url
  716. }
  717.  
  718. FUNCTION {book}
  719. { output.bibitem
  720.   list.label.output
  721.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  722.   author empty$
  723.     { editor "author and editor" item.check }
  724.     { crossref missing$
  725.     { "author and editor" editor either.or.check }
  726.     'skip$
  727.       if$
  728.     }
  729.   if$
  730.   title.field field.used =
  731.     { skip$ }
  732.     { format.btitle "title" output.check }
  733.   if$
  734.   crossref missing$
  735.     { format.bvolume output
  736.       format.number.series output
  737.       format.edition output
  738.       publisher "publisher" output.check
  739.       address output
  740.     }
  741.     { format.book.crossref output.nonnull
  742.       format.edition output
  743.     }
  744.   if$
  745.   new.block
  746.   note output
  747.   fin.entry
  748.   write.url
  749. }
  750.  
  751. FUNCTION {booklet}
  752. { output.bibitem
  753.   list.label.output
  754.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  755.   title.field field.used =
  756.     { skip$ }
  757.     { format.title quote "title" output.check }
  758.   if$
  759.   howpublished output
  760.   address output
  761.   new.block
  762.   note output
  763.   fin.entry
  764.   write.url
  765. }
  766.  
  767. FUNCTION {inbook}
  768. { output.bibitem
  769.   list.label.output
  770.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  771.   author empty$
  772.     { editor "author and editor" item.check }
  773.     { crossref missing$
  774.     { "author and editor" editor either.or.check }
  775.     'skip$
  776.       if$
  777.     }
  778.   if$
  779.   title.field field.used =
  780.     { skip$ }
  781.     { format.btitle "title" output.check }
  782.   if$
  783.   crossref missing$
  784.     { format.bvolume output
  785.       format.number.series output
  786.       format.edition output
  787.       publisher "publisher" output.check
  788.       address output
  789.     }
  790.     { format.book.crossref output.nonnull
  791.       format.edition output
  792.     }
  793.   if$
  794.   format.chapter.pages "chapter and pages" output.check
  795.   new.block
  796.   note output
  797.   fin.entry
  798.   write.url
  799. }
  800.  
  801. FUNCTION {incollection}
  802. { output.bibitem
  803.   list.label.output
  804.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  805.   title.field field.used =
  806.     { skip$ }
  807.     { format.title "title" output.check }
  808.   if$
  809.   author "author" item.check
  810.   crossref missing$
  811.     { format.in.ed.booktitle "booktitle" output.check
  812.       format.edition output
  813.       format.bvolume output
  814.       format.number.series output
  815.       publisher "publisher" output.check
  816.       address output
  817.     }
  818.     { format.incoll.inproc.crossref output.nonnull
  819.     }
  820.   if$
  821.   format.chapter.pages output
  822.   new.block
  823.   note output
  824.   fin.entry
  825.   write.url
  826. }
  827.  
  828. FUNCTION {inproceedings}
  829. { output.bibitem
  830.   list.label.output
  831.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  832.   title.field field.used =
  833.     { skip$ }
  834.     { format.title "title" output.check }
  835.   if$
  836.   author "author" item.check
  837.   crossref missing$
  838.     { format.in.ed.booktitle "booktitle" output.check
  839.       format.bvolume output
  840.       format.number.series output
  841.       address empty$
  842.     { organization output
  843.       publisher output
  844.     }
  845.     { organization output
  846.       publisher output
  847.           address output.nonnull
  848.      }
  849.       if$
  850.     }
  851.     { format.incoll.inproc.crossref output.nonnull
  852.     }
  853.   if$
  854.   format.pages output
  855.   new.block
  856.   note output
  857.   fin.entry
  858.   write.url
  859. }
  860.  
  861. FUNCTION {conference} { inproceedings }
  862.  
  863. FUNCTION {manual}
  864. { output.bibitem
  865.   list.label.output
  866.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  867.   title.field field.used =
  868.     { skip$ }
  869.     { format.btitle "title" output.check }
  870.   if$
  871.   format.edition output
  872.   author empty$
  873.     { organization empty$
  874.     { address output }
  875.     'skip$
  876.       if$
  877.     }
  878.     { organization output
  879.       address output
  880.     }
  881.   if$
  882.   new.block
  883.   note output
  884.   fin.entry
  885.   write.url
  886. }
  887.  
  888. FUNCTION {mastersthesis}
  889. { output.bibitem
  890.   list.label.output
  891.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  892.   author "author" item.check
  893.   title.field field.used =
  894.     { skip$ }
  895.     { format.title "title" output.check }
  896.   if$
  897.   "Master's thesis" format.thesis.type output.nonnull
  898.   school "school" output.check
  899.   address output
  900.   new.block
  901.   note output
  902.   fin.entry
  903.   write.url
  904. }
  905.  
  906. FUNCTION {misc}
  907. { output.bibitem
  908.   list.label.output
  909.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  910.   title.field field.used =
  911.     { skip$ }
  912.     { format.title quote output }
  913.   if$
  914.   howpublished output
  915.   new.block
  916.   note output
  917.   fin.entry
  918.   write.url
  919.   empty.misc.check
  920. }
  921.  
  922. FUNCTION {phdthesis}
  923. { output.bibitem
  924.   list.label.output
  925.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  926.   author "author" item.check
  927.   title.field field.used =
  928.     { skip$ }
  929.     { title "title" output.check }
  930.   if$
  931.   "PhD thesis" format.thesis.type output.nonnull
  932.   school "school" output.check
  933.   address output
  934.   new.block
  935.   note output
  936.   fin.entry
  937.   write.url
  938. }
  939.  
  940. FUNCTION {proceedings}
  941. { output.bibitem
  942.   list.label.output
  943.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  944.   title.field field.used =
  945.     { skip$ }
  946.     { format.btitle "title" output.check }
  947.   if$
  948.   format.bvolume output
  949.   format.number.series output
  950.   address empty$
  951.     { editor empty$
  952.     { skip$ }
  953.     { organization output
  954.     }
  955.       if$
  956.       publisher output
  957.     }
  958.     { editor empty$
  959.     'skip$
  960.     { organization output }
  961.       if$
  962.       publisher output
  963.       address output.nonnull
  964.     }
  965.   if$
  966.   new.block
  967.   note output
  968.   fin.entry
  969.   write.url
  970. }
  971.  
  972. FUNCTION {techreport}
  973. { output.bibitem
  974.   list.label.output
  975.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  976.   author "author" item.check
  977.   title.field field.used =
  978.     { skip$ }
  979.     { format.title "title" output.check }
  980.   if$
  981.   format.tr.number output.nonnull
  982.   institution "institution" output.check
  983.   address output
  984.   new.block
  985.   note output
  986.   fin.entry
  987.   write.url
  988. }
  989.  
  990. FUNCTION {unpublished}
  991. { output.bibitem
  992.   list.label.output
  993.   " \harvardyearleft " list.year * "\harvardyearright " * output.nonnull
  994.   author "author" item.check
  995.   title.field field.used =
  996.     { skip$ }
  997.     { format.title "title" output.check }
  998.   if$
  999.   new.block
  1000.   note "note" output.check
  1001.   fin.entry
  1002.   write.url
  1003. }
  1004.  
  1005. FUNCTION {default.type} { misc }
  1006.  
  1007. MACRO {jan} {"January"}
  1008.  
  1009. MACRO {feb} {"February"}
  1010.  
  1011. MACRO {mar} {"March"}
  1012.  
  1013. MACRO {apr} {"April"}
  1014.  
  1015. MACRO {may} {"May"}
  1016.  
  1017. MACRO {jun} {"June"}
  1018.  
  1019. MACRO {jul} {"July"}
  1020.  
  1021. MACRO {aug} {"August"}
  1022.  
  1023. MACRO {sep} {"September"}
  1024.  
  1025. MACRO {oct} {"October"}
  1026.  
  1027. MACRO {nov} {"November"}
  1028.  
  1029. MACRO {dec} {"December"}
  1030.  
  1031. MACRO {acmcs} {"ACM Computing Surveys"}
  1032.  
  1033. MACRO {acta} {"Acta Informatica"}
  1034.  
  1035. MACRO {cacm} {"Communications of the ACM"}
  1036.  
  1037. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1038.  
  1039. MACRO {ibmsj} {"IBM Systems Journal"}
  1040.  
  1041. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1042.  
  1043. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1044.  
  1045. MACRO {ieeetcad}
  1046.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1047.  
  1048. MACRO {ipl} {"Information Processing Letters"}
  1049.  
  1050. MACRO {jacm} {"Journal of the ACM"}
  1051.  
  1052. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1053.  
  1054. MACRO {scp} {"Science of Computer Programming"}
  1055.  
  1056. MACRO {sicomp} {"SIAM Journal on Computing"}
  1057.  
  1058. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1059.  
  1060. MACRO {tods} {"ACM Transactions on Database Systems"}
  1061.  
  1062. MACRO {tog} {"ACM Transactions on Graphics"}
  1063.  
  1064. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1065.  
  1066. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1067.  
  1068. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1069.  
  1070. MACRO {tcs} {"Theoretical Computer Science"}
  1071.  
  1072. READ
  1073.  
  1074. EXECUTE {init.field.constants}
  1075.  
  1076. FUNCTION {sortify}
  1077. { purify$
  1078.   "l" change.case$
  1079. }
  1080.  
  1081. FUNCTION {sortify.names}
  1082. { " \harvardand\ " " " replace.substring
  1083.   " et~al." " zzz" replace.substring
  1084.   sortify
  1085. }
  1086.  
  1087. FUNCTION {author.key.label}
  1088. { author empty$
  1089.     { key empty$
  1090.     { title.field 'field.used := }
  1091.     { key.field 'field.used := }
  1092.       if$
  1093.     }
  1094.     { author.field 'field.used := }
  1095.   if$
  1096. }
  1097.  
  1098. FUNCTION {author.editor.key.label}
  1099. { author empty$
  1100.     { editor empty$
  1101.     { key empty$
  1102.         { title.field 'field.used := }
  1103.         { key.field 'field.used := }
  1104.       if$
  1105.       }
  1106.     { editor.field 'field.used := }
  1107.       if$
  1108.     }
  1109.     { author.field 'field.used := }
  1110.   if$
  1111. }
  1112.  
  1113. FUNCTION {author.key.organization.label}
  1114. { author empty$
  1115.     { key empty$
  1116.     { organization empty$
  1117.         { title.field 'field.used := }
  1118.         { organization.field 'field.used := }
  1119.       if$
  1120.     }
  1121.     { key.field 'field.used := }
  1122.       if$
  1123.     }
  1124.     { author.field 'field.used := }
  1125.   if$
  1126. }
  1127.  
  1128. FUNCTION {editor.key.organization.label}
  1129. { editor empty$
  1130.     { key empty$
  1131.     { organization empty$
  1132.         { title.field 'field.used := }
  1133.         { organization.field 'field.used := }
  1134.       if$
  1135.     }
  1136.     { key.field 'field.used := }
  1137.       if$
  1138.     }
  1139.     { editor.field 'field.used := }
  1140.   if$
  1141. }
  1142.  
  1143. FUNCTION {sort.format.title}
  1144. { 't :=
  1145.   "A " #2
  1146.     "An " #3
  1147.       "The " #4 t chop.word
  1148.     chop.word
  1149.   chop.word
  1150.   sortify
  1151.   #1 global.max$ substring$
  1152. }
  1153.  
  1154. FUNCTION {calc.label} %%%XXX change
  1155. { make.abbr.label
  1156.   title.field field.used =
  1157.     { sort.format.title }
  1158.     { sortify.names }
  1159.   if$
  1160.   year field.or.null purify$ #-1 #4 substring$ sortify
  1161.   *
  1162.   'sort.label :=
  1163. }
  1164.  
  1165. FUNCTION {preliminaries} %%%XXX change
  1166. { type$ "book" =
  1167.   type$ "inbook" =
  1168.   or
  1169.     'author.editor.key.label
  1170.     { type$ "proceedings" =
  1171.     'editor.key.organization.label
  1172.     { type$ "manual" =
  1173.         'author.key.organization.label
  1174.         'author.key.label
  1175.       if$
  1176.     }
  1177.       if$
  1178.     }
  1179.   if$
  1180.   author.field field.used = %%%XXX change
  1181.     {
  1182.       author num.names$ #2 >
  1183.         { #1 }
  1184.         { #0 }
  1185.       if$
  1186.       'etal.required :=
  1187.     }
  1188.     {
  1189.       editor.field field.used = 
  1190.         {
  1191.           editor num.names$ #2 >
  1192.             { #1 }
  1193.             { #0 }
  1194.           if$
  1195.         }
  1196.         { #0 }
  1197.       if$
  1198.       'etal.required :=
  1199.     }
  1200.   if$
  1201.   #1 'etal.allowed :=
  1202. }
  1203.  
  1204. FUNCTION {first.presort}
  1205. { calc.label
  1206.   sort.label
  1207.   title.field field.used =
  1208.     { skip$ }
  1209.     { "    "
  1210.       *
  1211.       make.list.label sortify.names
  1212.       *
  1213.       "    "
  1214.       *
  1215.       title field.or.null
  1216.       sort.format.title
  1217.       *
  1218.     }
  1219.   if$
  1220.   #1 entry.max$ substring$
  1221.   'sort.key$ :=
  1222. }
  1223.  
  1224. ITERATE {preliminaries}
  1225.  
  1226. ITERATE {first.presort}
  1227.  
  1228. SORT
  1229.  
  1230. STRINGS { last.sort.label next.extra last.full.label}
  1231.  
  1232. INTEGERS { last.extra.num last.etal.allowed}
  1233.  
  1234. FUNCTION {initialize.confusion}
  1235. { #0 int.to.chr$ 'last.sort.label :=
  1236.   #0 int.to.chr$ 'last.full.label :=
  1237.   #1 'last.etal.allowed :=
  1238. }
  1239.  
  1240. FUNCTION {confusion.pass}
  1241. { last.sort.label sort.label =
  1242.     { last.etal.allowed 
  1243.         { last.full.label make.full.label sortify.names =
  1244.             { skip$ }
  1245.             { #0 'etal.allowed :=
  1246.               #0 'last.etal.allowed :=
  1247.             }
  1248.           if$
  1249.         }
  1250.         { #0 'etal.allowed := }
  1251.       if$
  1252.     }
  1253.     { sort.label 'last.sort.label :=
  1254.       make.full.label sortify.names 'last.full.label :=
  1255.       #1 'last.etal.allowed :=
  1256.     }
  1257.   if$
  1258. }
  1259.  
  1260. EXECUTE {initialize.confusion}
  1261.  
  1262. ITERATE {confusion.pass}
  1263.  
  1264. EXECUTE {initialize.confusion}
  1265.  
  1266. REVERSE {confusion.pass}
  1267.  
  1268. FUNCTION {initialize.last.extra.num}
  1269. { #0 int.to.chr$ 'last.sort.label :=
  1270.   "" 'next.extra :=
  1271.   #0 'last.extra.num :=
  1272. }
  1273.  
  1274. FUNCTION {forward.pass}
  1275. { last.sort.label sort.label =
  1276.     { last.extra.num #1 + 'last.extra.num :=
  1277.       last.extra.num int.to.chr$ 'extra.label :=
  1278.     }
  1279.     { "a" chr.to.int$ 'last.extra.num :=
  1280.       "" 'extra.label :=
  1281.       sort.label 'last.sort.label :=
  1282.     }
  1283.   if$
  1284. }
  1285.  
  1286. FUNCTION {reverse.pass}
  1287. { next.extra "b" =
  1288.     { "a" 'extra.label := }
  1289.     'skip$
  1290.   if$
  1291.   year empty$
  1292.     { "n.d." extra.label emphasize * 'list.year := }
  1293.     { year extra.label emphasize * 'list.year := }
  1294.   if$
  1295.   extra.label 'next.extra :=
  1296. }
  1297.  
  1298. ITERATE {first.presort}
  1299.  
  1300. SORT
  1301.  
  1302. EXECUTE {initialize.last.extra.num}
  1303.  
  1304. ITERATE {forward.pass}
  1305.  
  1306. REVERSE {reverse.pass}
  1307.  
  1308. FUNCTION {second.presort}
  1309. { make.list.label
  1310.   title.field field.used =
  1311.     { sort.format.title }
  1312.     { sortify.names }
  1313.   if$
  1314.   "    "
  1315.   *
  1316.   list.year field.or.null sortify
  1317.   *
  1318.   "    "
  1319.   *
  1320.   title.field field.used =
  1321.     { skip$ }
  1322.     { title field.or.null
  1323.       sort.format.title
  1324.       *
  1325.     }
  1326.   if$
  1327.   #1 entry.max$ substring$
  1328.   'sort.key$ :=
  1329. }
  1330.  
  1331. ITERATE {second.presort}
  1332.  
  1333. SORT
  1334.  
  1335. FUNCTION {begin.bib}
  1336. { preamble$ empty$
  1337.     'skip$
  1338.     { preamble$ write$ newline$ }
  1339.   if$
  1340.   "\begin{thebibliography}{xx}" write$ newline$
  1341. }
  1342.  
  1343. EXECUTE {begin.bib}
  1344.  
  1345. EXECUTE {init.state.consts}
  1346.  
  1347. ITERATE {call.type$}
  1348.  
  1349. FUNCTION {end.bib}
  1350. { newline$
  1351.   "\end{thebibliography}" write$ newline$
  1352. }
  1353.  
  1354. EXECUTE {end.bib}
  1355.